package com.mall.order.dto;

import com.mall.commons.result.AbstractResponse;
import lombok.Data;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**

 */
@Data
public class OrderListResponse extends AbstractResponse{

    private List<OrderDetailInfo> detailInfoList;

    public void setDetailInfoList(List<OrderDetailInfo> detailInfoList) {
        detailInfoList.sort(new Comparator<OrderDetailInfo>() {
            @Override
            public int compare(OrderDetailInfo o1, OrderDetailInfo o2) {
                return o2.getCreateTime().compareTo(o1.getCreateTime());
            }
        });

        this.detailInfoList = detailInfoList;
    }

    /**
     * 总记录数
     */
    private Long total;

}
